
@node-padding: 12px;
@node-width: 210px;
@node-heigth: 78px;
@node-border-radius: 8px;
// @canvas-bg: #f5f5f7;
@canvas-bg: #f2f3f5;

.node-wrap,
.branch-wrap {
  display: inline-flex;
  width: 100%;

  // 头部输入框
  .editable-title-input {
    width: 100%;
    height: 18px;
    margin: 0;
    padding-left: 4px;
    font-size: 12px;
    line-height: 18px;
    color: rgba(0, 0, 0, 0.65);
    background-color: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: all 0.3s;

    &::placeholder {
      color: #bfbfbf;
    }

    &:focus {
      outline: 0;
      border-color: #40a9ff;
      box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.2);
    }

    &:hover {
      text-decoration: none;
      border-color: #40a9ff;
    }
  }
}

// 节点卡片、分支卡片样式
.node-wrap .node-wrap-box,
.branch-wrap .auto-judge {
  &::after {
    pointer-events: none;
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    border-radius: @node-border-radius;
    border: 1px solid transparent;
    transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
    box-shadow: 0 2px 5px #0000001a;
  }

  &:hover {
    &::after {
      // border: 1px solid #3296fa;
      // box-shadow: 0 0 6px #3296fa4d;
      box-shadow: 0 13px 27px 0 #0000001a;
    }
  }

  .close {
    display: none;

    .arco-link-icon {
      color: #8f959e;
      margin-right: 0;
    }
  }
}

// 节点样式
.node-wrap {
  flex-direction: column;
  -webkit-box-pack: start;
  -ms-flex-pack: start;
  justify-content: flex-start;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-flex: 1;
  -ms-flex-positive: 1;
  padding: 0 50px;
  position: relative;

  .start-node {
    &::before {
      content: none !important;
    }
  }

  .node-wrap-box {
    position: relative;
    width: @node-width;
    min-height: @node-heigth;
    background: #fff;
    border-radius: @node-border-radius;
    cursor: pointer;
    display: flex;
    flex-direction: column;

    &::before {
      content: "";
      position: absolute;
      top: -8px;
      left: 50%;
      -webkit-transform: translateX(-50%);
      transform: translate(-50%);
      width: 0;
      height: 4px;
      border-style: solid;
      border-width: 8px 6px 4px;
      border-color: #cacaca transparent transparent;
      background: @canvas-bg;
    }

    &:hover {
      .close {
        display: inherit;
      }
    }

    .title {
      border-radius: @node-border-radius @node-border-radius 0 0;
      height: 28px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
      color: #fff;
      padding: 0 @node-padding;

      &:hover {
        .editable-title span {
          border-bottom: 1px dashed #fff;
        }
      }

      .iconfont {
        font-size: 12px;
        margin-right: 5px;
      }

      .editable-title {
        flex: 1;
      }
    }

    .content {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 5px @node-padding;

      .text {
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-wrap: break-word;
        word-break: break-all;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }

      .placeholder {
        color: #a1a5ad;
      }
    }
  }
}

// 分支
.branch-wrap {
  .branch-box-wrap {
    display: flex;
    -webkit-box-orient: vertical;
    flex-direction: column;
    flex-wrap: wrap;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    min-height: 270px;
    width: 100%;
    -ms-flex-negative: 0;
    flex-shrink: 0;

    .branch-box {
      display: flex;
      overflow: visible;
      min-height: 180px;
      height: auto;
      border-bottom: 2px solid #ccc;
      border-top: 2px solid #ccc;
      position: relative;
      margin-top: 15px;

      .col-box {
        background: @canvas-bg;
        display: inline-flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        flex-direction: column;
        -webkit-box-align: center;
        align-items: center;
        position: relative;

        &:before {
          content: "";
          position: absolute;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
          z-index: 0;
          margin: auto;
          width: 2px;
          height: 100%;
          background-color: #cacaca;
        }

        .condition-node,
        .condition-node-box {
          display: inline-flex;
          -webkit-box-orient: vertical;
          -webkit-box-direction: normal;
          flex-direction: column;
          -webkit-box-flex: 1;
        }

        .condition-node {
          /* min-height: 220px */

          .condition-node-box {
            padding-top: 30px;
            padding-right: 50px;
            padding-left: 50px;
            -webkit-box-pack: center;
            justify-content: center;
            -webkit-box-align: center;
            align-items: center;
            flex-grow: 1;
            position: relative;

            &:before {
              content: "";
              position: absolute;
              top: 0;
              left: 0;
              right: 0;
              bottom: 0;
              margin: auto;
              width: 2px;
              height: 100%;
              background-color: #cacaca;
            }
          }
        }
      }

      // 分页卡片样式
      .auto-judge {
        position: relative;
        width: @node-width;
        min-height: @node-heigth;
        background: #fff;
        border-radius: @node-border-radius;
        cursor: pointer;
        display: flex;
        flex-direction: column;

        &:hover {
          .priority-title {
            display: none;
          }

          .close {
            display: inherit;
          }
        }

        .title-wrapper {
          position: relative;
          font-size: 12px;
          color: #2eb795;
          height: 28px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          padding: 0 @node-padding;
          border-radius: @node-border-radius @node-border-radius 0 0;
          border-bottom: 1px solid #f6f6f7;

          &:hover {
            .editable-title {
              border-bottom: 1px dashed #2eb795;
            }
          }
        }

        .content-wrapper {
          display: flex;
          flex: 1;
          align-items: center;

          .sort-left,
          .sort-right {
            height: 100%;
            display: flex;
            align-items: center;
            padding: 0 2px;

            &:hover {
              background: #efefef;
            }
          }

          .content {
            flex: 1;
            padding: 0 @node-padding;
            min-height: 100%;
            display: flex;
            align-items: center;

            .text {
              width: 100%;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: normal;
              word-wrap: break-word;
              word-break: break-all;
              display: -webkit-box;
              -webkit-line-clamp: 2;
              -webkit-box-orient: vertical;
            }

            .placeholder {
              color: #a1a5ad;
            }
          }
        }
      }

      .default-branch-node {
        color: #646a73 !important;

        .title-wrapper {
          color: #646a73 !important;
        }
      }

      .add-branch {
        border: none;
        outline: none;
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        padding: 0 10px;
        height: 30px;
        border-radius: 15px;
        color: #3296fa;
        background: #fff;
        cursor: pointer;
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
        position: absolute;
        top: -16px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1;
        transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);

        &::after {
          content: "";
          position: absolute;
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          border-radius: 15px;
        }

        &:hover {
          transform: translate(-50%);
          box-shadow: 0 13px 27px 0 #0000001a;

          // &::after {
          //   border: 1px solid #3296fa;
          //   box-shadow: 0 0 6px #3296fa4d;
          // }
        }
      }

      .top-left-cover-line {
        left: -1px;
      }

      .top-right-cover-line {
        right: -1px;
      }

      .bottom-left-cover-line {
        left: -1px;
      }

      .bottom-right-cover-line {
        right: -1px;
      }

      .top-left-cover-line,
      .top-right-cover-line {
        position: absolute;
        height: 8px;
        width: 50%;
        background-color: @canvas-bg;
        top: -4px;
      }

      .bottom-left-cover-line,
      .bottom-right-cover-line {
        position: absolute;
        height: 8px;
        width: 50%;
        background-color: @canvas-bg;
        bottom: -4px;
      }
    }
  }
}

.node-content-tooltip {
  font-size: 12px;
  border-radius: var(--border-radius-medium);
}